file(GLOB MIDDLE_SOURCES
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB/*.c
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB/class/cdc/*.c
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB/common/*.c
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB/device/*.c
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB/portable/st/stm32_fsdev/*.c
)


set(MIDDLE_HEADERS
    ${PROJ_MIDDLEWARES_DIR}/TinyUSB
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/bsp
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/class/cdc
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/class/hid
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/common
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/device
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/osal
    # ${PROJ_MIDDLEWARES_DIR}/TinyUSB/portable/st/stm32_fsdev
    ${PROJ_APPLICATIONS_DIR}
    ${PROJ_DRIVERS_DIR}/CMSIS/Include
)

message(STATUS "Middleware Source: ${MIDDLE_SOURCES}")
message(STATUS "MIddleware Header: ${MIDDLE_HEADERS}")

add_library(middlewares
    ${MIDDLE_SOURCES}
)

target_include_directories(middlewares PUBLIC
    ${MIDDLE_HEADERS}
)

target_compile_definitions(middlewares PUBLIC 
    CFG_TUSB_MCU=OPT_MCU_STM32F1
)